import React, { Component } from 'react'
import { MyContext } from './index'
export class Child extends Component {
  render() {
    return (
      // 消费数据 value => {这里可以使用数据,并且返回组件结构}
      <MyContext.Consumer>
        {(value)=>{
          return(
          <div>
             子组件:{value.money}<button onClick={()=>value.updateMoney(4999)}>买手机</button>
          </div>
          )
          
        }}
      
      </MyContext.Consumer>
    )
  }
}

export default Child
